home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / Chip Temmuz 2004.iso / program / antispam / RazorAgent_SDK / razor-agents-sdk-2.03.exe / URI-1.19 / t / query.t < prev    next >
Encoding:
Text File  |  2001-01-11  |  1.0 KB  |  54 lines

  1. print "1..10\n";
  2.  
  3. use strict;
  4. use URI ();
  5. my $u = URI->new("", "http");
  6. my @q;
  7.  
  8. $u->query_form(a => 3, b => 4);
  9.  
  10. print "not " unless $u eq "?a=3&b=4";
  11. print "ok 1\n";
  12.  
  13. $u->query_form(a => undef);
  14. print "not " unless $u eq "?a=";
  15. print "ok 2\n";
  16.  
  17. $u->query_form("a=+& " => " =&+#");
  18. print "not " unless $u eq "?a%3D%2B%26+=+%3D%26%2B%23";
  19. print "ok 3\n";
  20.  
  21. @q = $u->query_form;
  22. print "not " unless join(":", @q) eq "a=+& : =&+#";
  23. print "ok 4\n";
  24.  
  25. @q = $u->query_keywords;
  26. print "not " if @q;
  27. print "ok 5\n";
  28.  
  29. $u->query_keywords("a", "b");
  30. print "not " unless $u eq "?a+b";
  31. print "ok 6\n";
  32.  
  33. $u->query_keywords(" ", "+", "=");
  34. print "not " unless $u eq "?%20+%2B+%3D";
  35. print "ok 7\n";
  36.  
  37. @q = $u->query_keywords;
  38. print "not " unless join(":", @q) eq " :+:=";
  39. print "ok 8\n";
  40.  
  41. @q = $u->query_form;
  42. print "not " if @q;
  43. print "ok 9\n";
  44.  
  45. $u->query(" +?=#");
  46. print "not " unless $u eq "?%20+?=%23";
  47. print "ok 10\n";
  48.  
  49. __END__
  50. # Some debugging while writing new tests
  51. print "\@q='", join(":", @q), "'\n";
  52. print "\$u='$u'\n";
  53.  
  54.